<?php

class Catalog_model extends CI_Model{
	private $table_name="catalog";

	public function getAll(){//拿catalog_id的数据
		$query = $this->db->get('catalog');
            return $query->result_array();
	}

	public function add_one($data){
		$this->db->insert($this->table_name,$data);
	}

	public function edit_one($id,$data){
		$this->db->where('id',$id)->update($this->table_name, $data);
	}

	public function del_one($id){
		$this->db->where('id',$id)->delete($this->table_name);
	}

	public function getOne($id){
		$query = $this->db->where("id",$id)->get($this->table_name);//拿到视图界面的id，然后通过id进行单独的操作
        return $query->row();
    }
}
